package api

import (
	"github.com/gin-gonic/gin"
	jwt "github.com/golangblogs/gojwt"
	"main/api/handler"
)

func RegisterRoutes(r *gin.Engine) {
	//r.Use(middleware.JwtTime())
	api := r.Group("/api")
	{
		user := api.Group("/user")
		{

			user.Use(jwt.JWTAuth("2210a"))
			user.POST("/register", handler.Register)
			user.POST("/login", handler.Login)
		}
		live := api.Group("/live")
		{
			live.POST("/add", handler.AddLive)
			live.GET("/list", handler.ListLive)
			live.POST("/update", handler.UpdateLive)
			live.POST("/del", handler.DelLive)
		}
		interaction := api.Group("/interaction")
		{
			interaction.POST("/add", handler.AddInteraction)
			interaction.GET("/list", handler.ListInteraction)
			interaction.POST("/update", handler.UpdateInteraction)
			interaction.POST("/del", handler.DelInteraction)
		}
		live_reward := api.Group("/gift_reward")
		{
			live_reward.POST("/add", handler.AddLiveReward)
			live_reward.GET("/list", handler.ListLiveReward)
			live_reward.POST("/update", handler.UpdateLiveReward)
			live_reward.POST("/del", handler.DelLiveReward)
		}
	}
}
